package org.hibernate.validator.xml;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(
        name = "fieldType",
        propOrder = {"valid", "constraint"}
)
public class FieldType {
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    protected String valid;
    protected List<ConstraintType> constraint;
    @XmlAttribute(
            required = true
    )
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    protected String name;
    @XmlAttribute(
            name = "ignore-annotations"
    )
    protected Boolean ignoreAnnotations;

    public FieldType() {
    }

    public String getValid() {
        return this.valid;
    }

    public void setValid(String value) {
        this.valid = value;
    }

    public List<ConstraintType> getConstraint() {
        if (this.constraint == null) {
            this.constraint = new ArrayList();
        }

        return this.constraint;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String value) {
        this.name = value;
    }

    public Boolean isIgnoreAnnotations() {
        return this.ignoreAnnotations;
    }

    public void setIgnoreAnnotations(Boolean value) {
        this.ignoreAnnotations = value;
    }
}